import pickle

d = {"a": "aaa", "b": "bbb"}
f1 = open("p.txt", "w")
pickle.dump(d, f1)
f1.close()

f2 = open("p.txt", "r")
d2 = pickle.load(f2)
print(d2)
